package com.pz.art.service.impl;


import java.util.List;

import com.pz.art.mapper.AnnualMapper;
import com.pz.art.service.AnnualService;
import com.pz.art.domain.AssoAnnual;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;


/**
 * 年度会费Service业务层处理
 *
 * @author ruoyi
 * @date 2025-02-20
 */
@Service
@Primary
public class AnnualServiceImpl implements AnnualService
{
    @Autowired
    private AnnualMapper assoAnnualMapper;

    /**
     * 查询年度会费
     *
     * @param id 年度会费主键
     * @return 年度会费
     */
    @Override
    public AssoAnnual selectAssoAnnualById(Long id)
    {
        return assoAnnualMapper.selectAssoAnnualById(id);
    }

    /**
     * 查询年度会费列表
     *
     * @param assoAnnual 年度会费
     * @return 年度会费
     */
    @Override
    public List<AssoAnnual> selectAssoAnnualList(AssoAnnual assoAnnual)
    {
        System.out.println(assoAnnualMapper.selectAssoAnnualList(assoAnnual));
        return assoAnnualMapper.selectAssoAnnualList(assoAnnual);
    }

    /**
     * 新增年度会费
     *
     * @param assoAnnual 年度会费
     * @return 结果
     */
    @Override
    public int insertAssoAnnual(AssoAnnual assoAnnual)
    {
        assoAnnual.setCreateTime(DateUtils.getNowDate());
        return assoAnnualMapper.insertAssoAnnual(assoAnnual);
    }

    /**
     * 修改年度会费
     *
     * @param assoAnnual 年度会费
     * @return 结果
     */
    @Override
    public int updateAssoAnnual(AssoAnnual assoAnnual)
    {
        assoAnnual.setUpdateTime(DateUtils.getNowDate());
        return assoAnnualMapper.updateAssoAnnual(assoAnnual);
    }

    /**
     * 批量删除年度会费
     *
     * @param ids 需要删除的年度会费主键
     * @return 结果
     */
    @Override
    public int deleteAssoAnnualByIds(Long[] ids)
    {
        return assoAnnualMapper.deleteAssoAnnualByIds(ids);
    }

    /**
     * 删除年度会费信息
     *
     * @param id 年度会费主键
     * @return 结果
     */
    @Override
    public int deleteAssoAnnualById(Long id)
    {
        return assoAnnualMapper.deleteAssoAnnualById(id);
    }

    @Override
    public AjaxResult getUnitTotal() {
        AjaxResult ajaxResult = new AjaxResult();
//
//        ajaxResult.put("unit_count",);
//        ajaxResult.put("annual",);
        return ajaxResult;
    }
}

